const path = require('path');
const fs = require('fs');

setInterval(()=>{
	const file = path.join(__dirname, 'message.txt');
	fs.appendFile(file, "123\n", (err) => {
	  if (err) throw err;
	  console.log('The file has been saved!');
	});
}, 1000);